package com.zsw.dubbo.register;

import java.io.IOException;
import java.util.List;

import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import org.junit.runner.RunWith;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.alibaba.dubbo.common.URL;

@RunWith(SpringJUnit4ClassRunner.class)
public class Test {
	public static void main(String[] args) throws IOException, KeeperException, InterruptedException {
		ZooKeeper zoo = new ZooKeeper("17.18.2.65:2181", 30000000, new Watcher() {
			public void process(WatchedEvent event) {}
		});
		List<String> stat = zoo.getChildren("/seal_group/com.kfx.seal.dubbo.service.DemoService/providers",false);
		if(stat.size() > 0){
			System.out.println(URL.decode(stat.get(0)));
		}
	}
	
	@org.junit.Test
	public void testName() throws Exception {
		
	}
}
